package com.ruoyi.back.domain

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableLogic
import com.baomidou.mybatisplus.annotation.TableName
import com.ruoyi.back.enums.UserStatusEnum
import com.ruoyi.back.enums.UserTypeEnum
import org.springframework.format.annotation.DateTimeFormat
import java.util.*
import javax.persistence.*

@TableName("fly_app_user")
@Entity
@Table(name = "fly_app_user")
data class AppUser(

    /**
     * 自增id
     */
    @TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    var id: Long? = 1L,

    /**
     * 用户id
     */
    var userId: String? = null,

    /**
     * 密码
     */
    var password: String? = null,

    /**
     * 用户名
     */
    var username: String? = null,

    /**
     * 头像
     */
    var headUrl: String? = null,

    /**
     * 用户类型
     */
    var userType: Int? = UserTypeEnum.NORMAL.code,

    /**
     * 注册日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var registerDate: Date? = Date(),

    /**
     * 来源渠道
     */
    var source: String? = null,

    /**
     * 登录方式
     */
    var loginType: Int? = null,

    /**
     * 最后登录日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var lastLoginDate: Date? = null,

    /**
     * 用户状态
     */
    var status: Int? = UserStatusEnum.NORMAL.code,

    /**
     * 三方id
     */
    var openId: String? = null,

    /**
     * 逻辑删除
     */
    @TableLogic
    var deleted: Int? = 0
)
